<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>改变数组的顺序案例</title>
  <script src="../vue.js"></script>
</head>

<body>
  <div id="app">
    <ul>
      <li v-for="(item,index) in arr" :key="index">
        {{item.name}}
      </li>
    </ul>
    <button @click="btn">按钮</button>
  </div>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        arr: [
          { id: 1, name: 'xiaoming1' },
          { id: 2, name: 'xiaoming2' },
          { id: 3, name: 'xiaoming3' },
        ]
      },
      methods: {
        btn() {
          this.arr.push(this.arr.shift())
        }
      }
    })
  </script>
</body>

</html>